package cn.gson.crm.control.position;


import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.gson.crm.control.base.BaseServlet;
import cn.gson.crm.model.dao.PositionDao;

/**
 * Servlet implementation class AddJobServlet
 */
@WebServlet("/addjob")
public class AddJobServlet extends BaseServlet {
	private static final long serialVersionUID = 1L;
	private PositionDao pd=new PositionDao();
	@Override
	protected void post(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String positionName=request.getParameter("positionName");
		String description=request.getParameter("description");
		if(positionName!=null&&!positionName.isEmpty()){
			if (pd.addPosition(positionName,description)) {
				redirect("job");
				//response.sendRedirect("job");
			}
		}else {
			request.setAttribute("error", "职位名称不能为空");
			redirect("job");
		}
	}
	
}
